﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MuseLibrary.Packets
{
    public class AccelerometerPacket : Packet
    {
        internal AccelerometerPacket()
        {
            _channels = new int[3];
        }

        protected override void DoInitialisation()
        {
            var processedValues = _rawData.To10BitIntegers(1, 3);
            _channels[0] = processedValues[2];
            _channels[1] = processedValues[1];
            _channels[2] = processedValues[0];
        }

        private int[] _channels;

        public int[] Channels
        {
            get { return _channels; }
        }
    
        public override PacketType Type
        {
            get { return PacketType.Accelerometer; }
        }

        public override int Length
        {
            get
            {
                return (HasFlags) ? 7 : 5;
            }
        }
    }
}
